<!DOCTYPE html>
<meta charset="UTF-8">
<div id="tt" class="easyui-tabs">   
    <div title="我关注的" style="padding:10px;width: 100%;height: 100%">   
		      <table
			     class="easyui-datagrid"   
			     id="datagrid1"  
		         url="${base}/userfollow/followingListPage?fromUserId=${uid}"
		         pagination="true"
		         rownumbers="true" 
		         data-options="onClickCell:onClickCell,onEndEdit:onEndEdit,pageSize:20,pageList:[2,10,20,30]" >  
		    <thead>  
		        <tr> 
		            <th data-options="field:'realname',align:'center'" width="10%" formatter="formatFollowingUserName">用户名</th>
		            <th data-options="field:'umobile',align:'center'" width="10%" formatter="formatFollowingMobile">电话</th>
		            <th data-options="field:'industry',align:'center'" width="10%" formatter="formatFollowingIndustry">行业</th>
		            <th data-options="field:'relation',align:'center'" width="10%" formatter="formatRelation">当前关系</th>
		        </tr>
		    </thead>
		</table>    
    </div>   
    <div title="关注我的"  style="padding:10px;width: 100%;height: 100%">   
		        <table
			     class="easyui-datagrid"   
			     id="datagrid2"  
		         url="${base}/userfollow/followedListPage?toUserId=${uid}"
		         pagination="true"
		         rownumbers="true" 
		         data-options="onClickCell:onClickCell,onEndEdit:onEndEdit,pageSize:20,pageList:[2,10,20,30]" >  
		    <thead>  
		       <tr> 
		            <th data-options="field:'realname',align:'center'" width="10%" formatter="formatFollowedUserName">用户名</th>
		            <th data-options="field:'umobile',align:'center'" width="10%" formatter="formatFollowedMobile">电话</th>
		            <th data-options="field:'industry',align:'center'" width="10%" formatter="formatFollowedIndustry">行业</th>
		            <th data-options="field:'relation',align:'center'" width="10%" formatter="formatRelation">当前关系</th>
		        </tr>
		    </thead>
		</table>    
    </div>   
 
</div>
<script>
  //关注的
  function formatFollowingUserName(value,row,index){
	  return row.toUser.realname;
  }
  
  function formatFollowingMobile(value,row,index){
	  return row.toUser.umobile;
  }
  
  function formatFollowingIndustry(value,row,index){
	  return row.toUser.industry;
  }
  
  //被关注
  function formatFollowedUserName(value,row,index){
	  return row.fromUser.realname;
  }
  
  function formatFollowedMobile(value,row,index){
	  return row.fromUser.umobile;
  }
  
  function formatFollowedIndustry(value,row,index){
	  return row.fromUser.industry;
  }
  function formatRelation(value,row,index){
	  var str="不合法的关系";
	  var relation = row.relation;
	  console.log(relation);
	  if(relation==0){
		  str="互不关注";
	  }else if(relation==1){
		  str="关注";
	  }else if(relation==2){
		  str="被关注";
	  }else if(relation ==3){
		  str="互相关注";
	  }
	  return str;
  }
</script>